<template>
  <div id="center">
    <div class="up">
      <div
        v-for="item in titleItem"
        :key="item.title"
        class="bg-color-black item"
      >
        <p class="ml-3 colorBlue fw-b">{{ item.title }}</p>
        <div>
          <dv-digital-flop
            :config="item.number"
            style="margin-top: -1.35rem;"
          />
        </div>
      </div>
    </div>
    <div class="down">
      <div class="ranking bg-color-black">
        <span style="color: #5cd9e8;">
          <icon name="align-left" />
        </span>
        <span class="fs-xl text mx-2 mb-1">年度停电榜</span>
        <dv-scroll-ranking-board :config="ranking" style="height: 12.75rem;" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
    data() {
        return {
            titleItem: [
                {
                    title: "今年累计停电次数",
                    number: {
                        number: [532],
                        //toFixed: 1, 小数点位数
                        content: "{nt}"
                    }
                },
                {
                    title: "本月累计停电次数",
                    number: {
                        number: [186],
                        //toFixed: 1,
                        content: "{nt}"
                    }
                },
                {
                    title: "今日累计停电次数",
                    number: {
                        number: [21],
                        //toFixed: 1,
                        content: "{nt}"
                    }
                },
                {
                    title: "今年累计发电次数",
                    number: {
                        number: [499],
                        //toFixed: 1,
                        content: "{nt}"
                    }
                },
                {
                    title: "本月累计发电次数",
                    number: {
                        number: [184],
                        //toFixed: 1,
                        content: "{nt}"
                    }
                },
                {
                    title: "今天累计发电次数",
                    number: {
                        number: [21],
                        //toFixed: 1,
                        content: "{nt}"
                    }
                }
            ],
            ranking: {
                data: [
                    {
                        name: "宁明",
                        value: 155
                    },
                    {
                        name: "江州",
                        value: 120
                    },
                    {
                        name: "扶绥",
                        value: 78
                    },
                    {
                        name: "天等",
                        value: 66
                    },
                    {
                        name: "大新",
                        value: 41
                    },
                    {
                        name: "凭祥",
                        value: 35
                    },
                    {
                        name: "龙州",
                        value: 21
                    }
                ],
                carousel: "single",
                unit: "次"
            },
            water: {
                data: [24, 45],
                shape: "roundRect",
                formatter: "{value}%",
                waveNum: 3
            },
            // 通过率和达标率的组件复用数据
            rate: [
                {
                    id: "centerRate1",
                    tips: 60,
                    colorData: {
                        textStyle: "#3fc0fb",
                        series: {
                            color: ["#00bcd44a", "transparent"],
                            dataColor: {
                                normal: "#03a9f4",
                                shadowColor: "#97e2f5"
                            }
                        }
                    }
                },
                {
                    id: "centerRate2",
                    tips: 40,
                    colorData: {
                        textStyle: "#67e0e3",
                        series: {
                            color: ["#faf3a378", "transparent"],
                            dataColor: {
                                normal: "#ff9800",
                                shadowColor: "#fcebad"
                            }
                        }
                    }
                }
            ]
        };
    }
};
</script>

<style lang="scss" scoped>
#center {
    display: flex;
    flex-direction: column;
    .up {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
        .dv-digital-flop {
            font-size: 14px;
        }
        .item {
            border-radius: 0.0625rem;
            padding-top: 0.2rem;
            margin-top: 0.1rem;
            width: 32%;
            height: 3.875rem;
            font-size: 12px;
        }
    }
    .down {
        padding: 0.07rem 0.05rem;
        padding-bottom: 0;
        width: 100%;
        display: flex;
        height: 3.1875rem;
        justify-content: space-between;
        .bg-color-black {
            border-radius: 0.0625rem;
        }
        .ranking {
            padding: 0.125rem;
            width: 100%;
        }
        .percent {
            width: 40%;
            display: flex;
            flex-wrap: wrap;
            .item {
                width: 50%;
                height: 1.5rem;
                span {
                    margin-top: 0.0875rem;
                    display: flex;
                    justify-content: center;
                }
            }
            .water {
                width: 100%;
            }
        }
    }
}
</style>